home *** CD-ROM | disk | FTP | other *** search
- Path: news.u.washington.edu!trstedl
- From: trstedl@u.washington.edu (Todd Stedl)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: GPF in BC++ 4.5
- Date: 16 Feb 1996 20:18:23 GMT
- Organization: University of Washington, Seattle
- Message-ID: <4g2oqf$sjc@nntp5.u.washington.edu>
- NNTP-Posting-Host: homer01.u.washington.edu
- NNTP-Posting-User: trstedl
-
- I'm having problems with a General Protection Exception that I
- continually get from a program I run in Borland C++ 4.5. The reason I'm
- cross posting to the C group is b/c it's a standard C program. I've
- looked at Borland's Web site but found no help there.
-
- Here's the basics of the program:
- I use a lot of arrays and need to write to 2 separate data files, so I
- allocate the memory accordingly. I allocate the the file names as
- pointers to char since their names may change depending upon certain
- parameters in the program.
- char *over_name, *data_name;
-
- In the main program I reserve memory for the names.
- over_name = (char*)malloc(20*sizeof(char));
- data_name = ...
-
- And the very last thing I do in main is free the memory.
- free(over_name);
- etc.
-
- At that point I'm also freeing all the arrays I've used, too.
-
- Now, whenever the program executes the free(over_name) line, I get the
- following runtime error:
- General Protection Exception
- 0xhhhh:0x4FBD
- LAN(1) 0xhhhh:0x4FBD Processor Fault
-
- where hhhh is some hex number, but the 0x4FBD is always the same. LAN is
- the name of my project.
-
- The thing that gets me is that the GPF occurs *only* when the program
- executes free(over_name) ! It doesn't matter if it's the first item I
- free or the last; it doesn't matter where I allocate the memory for it;
-